transition_matrix = [
    [1, 1, 1, 0, 0, 0, 0],
    [1, 0, 0, 0, 0, 0, 0],
    [0, 1, 0, 0, 0, 0, 0],
    [1, 1, 1, 1, 1, 1, 0],
    [0, 0, 0, 1, 0, 0, 0],
    [0, 0, 0, 0, 1, 0, 0],
    [0, 0, 1, 1, 1, 2, 3],
]

count = [1, 0, 0, 0, 0, 0, 0]

for i in range(30):
    count = [sum(a*b for a, b in zip(r, count)) for r in transition_matrix]
    print count, sum(count[:-1])